<?php require_once('../Connections/elevate954.php'); ?>
<?php require_once("../webassist/database_management/wa_appbuilder_php.php"); ?>
<?php require_once( "../webassist/security_assist/helper_php.php" ); ?>
<?php
if (!WA_Auth_RulePasses("Logged in to ADMIN_SETTINGS")){
	WA_Auth_RestrictAccess("../login_admin.php");
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
?>
<?php
$Paramcategory_id_WADAmembership_cat = "-1";
if (isset($_GET['category_id'])) {
  $Paramcategory_id_WADAmembership_cat = $_GET['category_id'];
}
mysql_select_db($database_elevate954, $elevate954);
$query_WADAmembership_cat = sprintf("SELECT category_id, CATEGORY_NAME, SORT_ORDER FROM membership_cat WHERE category_id = %s", GetSQLValueString($Paramcategory_id_WADAmembership_cat, "int"));
$WADAmembership_cat = mysql_query($query_WADAmembership_cat, $elevate954) or die(mysql_error());
$row_WADAmembership_cat = mysql_fetch_assoc($WADAmembership_cat);
$totalRows_WADAmembership_cat = mysql_num_rows($WADAmembership_cat);
?>
<?php 
// WA DataAssist Update
if (isset($_POST["Update"]) || isset($_POST["Update_x"])) // Trigger
{
  $WA_connection = $elevate954;
  $WA_table = "membership_cat";
  $WA_redirectURL = "membership_cat_results.php?category_id=".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"")  ."".(isset($_GET["pageNum_WADAmembership_cat"])?"&pageNum_WADAmembership_cat=".intval($_GET["pageNum_WADAmembership_cat"]):"")  ."";
  if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
  $WA_keepQueryString = false;
  $WA_indexField = "category_id";
  $WA_fieldNamesStr = "category_id|CATEGORY_NAME|SORT_ORDER";
  $WA_fieldValuesStr = "".((isset($_POST["category_id"]))?$_POST["category_id"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["CATEGORY_NAME"]))?$_POST["CATEGORY_NAME"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["SORT_ORDER"]))?$_POST["SORT_ORDER"]:"")  ."";
  $WA_columnTypesStr = "',none,''|',none,''|',none,''";
  $WA_comparisonStr = " LIKE | LIKE | LIKE ";
  $WA_fieldNames = explode("|", $WA_fieldNamesStr);
  $WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
  $WA_columns = explode("|", $WA_columnTypesStr);
  
  $WA_where_fieldValuesStr = "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"")  ."";
  $WA_where_columnTypesStr = "',none,''";
  $WA_where_comparisonStr = "=";
  $WA_where_fieldNames = explode("|", $WA_indexField);
  $WA_where_fieldValues = explode($WA_AB_Split, $WA_where_fieldValuesStr);
  $WA_where_columns = explode("|", $WA_where_columnTypesStr);
  $WA_where_comparisons = explode("|", $WA_where_comparisonStr);
  
  $WA_connectionDB = $database_elevate954;
  mysql_select_db($WA_connectionDB, $WA_connection);
  @session_start();
  $updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
  $WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues,  $WA_where_comparisons );
  $WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
  $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
  if ($WA_redirectURL != "")  {
    if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
      $WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
    }
    header("Location: ".$WA_redirectURL);
  }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script src="../webassist/progress_bar/jquery-blockui-formprocessing.js" type="text/javascript"></script>

<link href="../webassist/forms/fd_basic_default.css" rel="stylesheet" type="text/css">
<link href="../webassist/forms/dataassist_button.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="Update_Basic_Default_ProgressWrapper">
<form class="Basic_Default" id="Update_Basic_Default" name="Update_Basic_Default" method="post" action="<?php echo(htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)."?".$_SERVER["QUERY_STRING"]); ?>">
        <fieldset class="Basic_Default" id="Update">
          <legend class="groupHeader">Update</legend>
    <div class="lineGroup"> 
                          <div class="errorGroup">
     <span>
  <input id="category_id" name="category_id" type="hidden" value="<?php echo((isset($_GET["invalid"])?ValidatedField("membershipcatupdate","category_id"):"".$row_WADAmembership_cat["category_id"]."")); ?>" class="formTextfield_Medium" tabindex="1">
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="CATEGORY_NAME" class="sublabel" > CATEGORY NAME:</label>
                          <div class="errorGroup">
     <span>
  <input id="CATEGORY_NAME" name="CATEGORY_NAME" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("membershipcatupdate","CATEGORY_NAME"):"".$row_WADAmembership_cat["CATEGORY_NAME"]."")); ?>" class="formTextfield_Medium" tabindex="2">
	   </span>
                          </div>
    </div> 
    <div class="lineGroup"> <label for="SORT_ORDER" class="sublabel" > SORT ORDER:</label>
                          <div class="errorGroup">
     <span>
  <input id="SORT_ORDER" name="SORT_ORDER" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("membershipcatupdate","SORT_ORDER"):"".$row_WADAmembership_cat["SORT_ORDER"]."")); ?>" class="formTextfield_Medium" tabindex="3">
	   </span>
                          </div>
    </div> 
        <span class="buttonFieldGroup" >
          <input type="submit" value="Update" class="formButton" id="Update" name="Update" />
        </span>
        </fieldset>
<input type="hidden" name="WADAUpdateRecordID" id="WADAUpdateRecordID" value="<?php echo((isset($_GET["invalid"])?ValidatedField("membershipcatupdate","WADAUpdateRecordID"):$_GET["category_id"])); ?>" />
</form></div><div id="Update_Basic_Default_ProgressMessageWrapper" class="blockUIOverlay" style="display:none;">
<script type="text/javascript">
WADFP_SetProgressToForm('Update_Basic_Default', 'Update_Basic_Default_ProgressMessageWrapper', WADFP_Theme_Options['BigSpin:Slate']);
</script>
<div id="Update_Basic_Default_ProgressMessage" >
	<p style="margin:10px; padding:5px;" ><img src="../webassist/progress_bar/images/slate-largespin.gif" alt="" title="" style="vertical-align:middle;" />&nbsp;&nbsp;Please wait</p>
</div>
</div>

</body>
</html>
<?php
mysql_free_result($WADAmembership_cat);
?>
